//
//  ViewController.swift
//  PropertyWrappers
//
//  Created by fanxiaoxin_1987@126.com on 11/03/2021.
//  Copyright (c) 2021 fanxiaoxin_1987@126.com. All rights reserved.
//

import UIKit
import PropertyWrappers

class ViewController: UIViewController {
    
    @PWUserDefault("TEST_VALUE", defaultValue: 3)
    static var userDefaultValue: Int
    
    @PWUserDefault.Refer(ViewController.$userDefaultValue)
    var userDefaultRefer: Int
    
    @PWLazy
    var lazyValue: String = {
        print("FUCK ME")
        return "FUCK"
    }()

    @PWBoundary(..<8)
    var value: Int = 3
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        print("FUCK \(Self.userDefaultValue)")
        Self.userDefaultValue += 1
        print("FUCK \(Self.userDefaultValue)")
        
        print("FUCK \(self.userDefaultRefer)")
        self.userDefaultRefer += 1
        print("FUCK \(self.userDefaultRefer)")
        
        print("FUCK \(Self.userDefaultValue)")
        
        // Do any additional setup after loading the view, typically from a nib.
        
        print("PW: \(self._lazyValue)")
        print("PWV: \(self._lazyValue.value)")
        print("ORG: \(self.lazyValue)")
        print("PWV: \(self._lazyValue.value)")
        
        self.value = -9
        print("FUCK \(self.value)")
        self.value = 3
        print("FUCK \(self.value)")
        self.value = 10
        print("FUCK \(self.value)")
        self.value = 8
        print("FUCK \(self.value)")
        self.value = 5
        print("FUCK \(self.value)")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
